#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgDB/Registry>

#include <osgODE/TriMesh>
#include <osgODEUtil/CreateTriMeshFromNode>




int
main(int argc, char** argv)
{
    {
        osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options() ;
        options->setOptionString("WriteImageHint=IncludeFile") ;
        osgDB::Registry::instance()->setOptions(options);
    }
    {
        osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options() ;
        options->setOptionString("Compressor=zlib") ;
        osgDB::Registry::instance()->setOptions(options);
    }




    osg::Node*  graphics = osgDB::readNodeFile( argv[1] ) ;


    osg::ref_ptr<osgODE::TriMesh>   physics = osgODEUtil::createTriMeshFromNode( graphics )  ;


    physics->setKinematic( true ) ;


    physics->getMatrixTransform()->addChild( graphics ) ;



    osgDB::writeObjectFile( *physics, argv[2] ) ;


    return 0 ;
}
